import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    count: 0,
    userinfo: null
  },
  // 唯一改变状态的方法
  mutations: {
    update (state, userinfo) {
      this.state.userinfo = userinfo
    },
    number (state, x) {
      console.log(x)
      this.state.count = this.state.count + x
    }
  },
  actions: {

  },
  getters: {

  }
})
